#pragma once
#include <vector>
using namespace std;
#include "Shape.h"
#include "Triangle.h"
//class Triangle;
#include "Light.h"
#include "Camera.h"

#include "ShaderCollection.h"
//#include "BVH.h"
class BVH;



class Scene{
public:
	Scene();
	~Scene();

	Shape* addShape(Shape *_sh){
		//printf("Added a shape\n");
		theShapes->push_back(_sh);
		return theShapes->back();
	}
	void addLight(Light *_l){
		printf("Added a light\n");
		theLights->push_back(_l);
	}
	void addCamera(Camera _c){
		printf("Added a camera\n");
		theCameras->push_back(_c);
	}
	ShaderCollection* addShader(ShaderCollection _sh){
		printf("Added a shader collection\n");
		theShaders->push_back(_sh);
		return &(theShaders->back());
	}

	void clearShapes(){ theShapes->clear(); }
	void clearLights(){ theLights->clear(); }
	void clearCameras(){ theCameras->clear(); }

	void addTriangle(vec3 _pt1, vec3 _rot, vec3 _pt2, vec3 _pt3);

	void removeShape(vector<Shape*>::iterator);
	void removeLight(vector<Light*>::iterator);
	void removeCamera(vector<Camera>::iterator);
	void removeShader(vector<ShaderCollection>::iterator);

	vector<Shape*>::iterator shapes(int start = 0){ return theShapes->begin() + start; }
	vector<Light*>::iterator lights(int start = 0){ return theLights->begin() + start; }
	vector<Camera>::iterator cameras(int start = 0){ return theCameras->begin() + start; }
	vector<ShaderCollection>::iterator shaders(int start = 0){ return theShaders->begin() + start; }
	Camera* latestCamera(){ return &(theCameras->back()); }

	int shapeCount(){ return theShapes->size(); }
	int lightCount(){ return theLights->size();	}
	int shaderCount(){ return theShaders->size(); }

	void theBVH(BVH *_b){ _theBVH = _b; };
	BVH* theBVH(){ return _theBVH; };

private:
	//vector of shapes
	vector<Shape*>* theShapes;
	//vector of lights
	vector<Light*>* theLights;
	//vector of cameras
	vector<Camera>* theCameras;
	//pointer to active camera
	Camera* activeCamera;
	//vector of shaders
	vector<ShaderCollection>* theShaders;

	BVH* _theBVH;
};

